package org.wen.soft.generate.service;

import org.springframework.stereotype.Service;
import org.wen.soft.asm.AsmLoad;
import org.wen.soft.generate.model.GeneClass;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

@Service
public class GeneraService {

    @Resource
    private SaveService saveService;

    public void generaByFiles(String templateName, List<String> files) {
        files.forEach(file -> {
            GeneClass geneClass = new GeneClass(AsmLoad.loadClass(file));
            saveService.saveTestFile(templateName, geneClass);
        });
    }

    public void generaByFiles(String templateName, String... files){
        generaByFiles(templateName, Arrays.asList(files));
    }
}
